#include "apue.h"
#include <string.h>
#include "sys/select.h"

void sleep_us(struct timeval *tv) {
    select(0, NULL, NULL, NULL, tv);
}

int main(int argc, char ** argv) {
    if (argc != 2)
        err_quit("Usage: sleep_us <second>");

    struct timeval tv;
    tv.tv_sec= atoi(argv[1]);
    printf("I will sleep %d second.\n", (int)tv.tv_sec);
    sleep_us(&tv);
    printf("end\n");
}
